const pass = (length) => {
	var timestamp = new Date().getTime();
	var timestamp32 = timestamp.toString(32);
	if (length <= 9) {
		var start_num = 9 - length;
		var res_str = timestamp32.substring(start_num, 9);
	} else if (length > 9) {
		var length = length - 9;
		var str = '';
		var str_arr = [
			'0',
			'1',
			'2',
			'3',
			'4',
			'5',
			'6',
			'7',
			'8',
			'9',
			'A',
			'B',
			'C',
			'D',
			'E',
			'F',
			'G',
			'H',
			'I',
			'J',
			'K',
			'L',
			'M',
			'N',
			'O',
			'P',
			'Q',
			'R',
			'S',
			'T',
			'U',
			'V',
			'W',
			'X',
			'Y',
			'Z',
			'a',
			'b',
			'c',
			'd',
			'e',
			'f',
			'g',
			'h',
			'i',
			'j',
			'k',
			'l',
			'm',
			'n',
			'o',
			'p',
			'q',
			'r',
			's',
			't',
			'u',
			'v',
			'w',
			'x',
			'y',
			'z',
			'_'
		];
		for (var i = 0; i < length; i++) {
			var r = parseInt(Math.random() * 62);
			str += str_arr[r];
		}
		res_str = str + timestamp32;
	}
	return res_str;
}

module.exports = {
	pass
}
